#ifndef _NE_MIDI_IN_DEVICE_MACOSX_H_
#define _NE_MIDI_IN_DEVICE_MACOSX_H_

#include <audio/MIDI/MIDIInDevice.h>

#if NE_PLATFORM == NE_PLATFORM_MACOSX

#include <CoreMIDI/CoreMIDI.h>

namespace ne
{
    class NEAPI MIDIInDeviceMacOSX : public MIDIInDevice
    {
        public:
            MIDIInDeviceMacOSX(const uint32_t id, const std::string &name);

            virtual bool open();

            virtual bool reset();

            virtual bool close();

            virtual bool receivedEvent();

            virtual ~MIDIInDeviceMacOSX();

        protected:
            virtual bool _create();

            virtual bool _destroy();

        public:
            static void NotifyCallback(const MIDINotification *message, void *refCon);

            static void ReadCallback(const MIDIPacketList *pktlist, void *readProcRefCon, void *srcConnRefCon);
            static void CompletionCallback(MIDISysexSendRequest *request);

        private:
            MIDIClientRef mClient;
            MIDIEndpointRef mSource;
            MIDIPortRef mInPort;
    };
}

#endif

#endif
